#include<stdio.h>
#include<math.h>

const int MAX= 100;
// use typedef for some generic
typedef int Element;

inline int min_int(int a, int b);
int min_int(int a, int b)
{
    return a<b ? a:b;
}

// merge [left,mid),[mid,right), store res in aux
void merge(Element* l, Element* aux, int left, int mid,int right)
{
    int i=left,j=mid,k=left;
    while(i<mid && j<right)
    {
        if(l[i]<l[j])aux[k] = l[i++];
        else aux[k] = l[j++];
        k++;
    }
    if(i>=mid){while(j<right)aux[k++] = l[j++];}
    else {while(i<mid)aux[k++] = l[i++];}
}
void MergeSort(Element* l, int N)
{
    const int MAXI = ceil(log2(N));
    int flag = 1;// mark where should store the res. if flag, res will be stored in aux
    int aux[MAX];
    for(int i=0;i<MAXI;++i)
    {
        int d = 1<<i;   // d = 2^i
        const int MAXJ = ceil(N/d);
        for(int j = 0;j < MAXJ;j+=2)
        {
            if(flag) merge(l,aux,j*d,min_int((j+1)*d,N), min_int((j+2)*d,N));
            else merge(aux,l,j*d,min_int((j+1)*d,N), min_int((j+2)*d,N));
        }
        flag = (flag+1) % 2;
    }
    if(!flag)  // should copy res back to l
    {
        for(int i=0;i<N;++i)l[i] = aux[i];
    }
}

int main(int argc, char const *argv[])
{
    freopen("./algorithm/test.txt","r",stdin);
    int N; scanf("%d",&N);
    int l[MAX]; for(int i=0;i<N;i++) scanf("%d",l+i);

    MergeSort(l,N);
    
    for(int i=0;i<N;++i)
    {
        printf("%d ",l[i]);
    }
    return 0;
}
